<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function runAsync(){
        var p = new Promise(function(resolve, reject){
            //做一些异步操作
            var img = new Image()
            img.src = "./bg.jpg"
            img.onload = function () {
                resolve(img)
            }
        });
        return p;
    }

    console.log(runAsync())
</script>
</body>
</html>